package com.woniuxy.micromedicalserver.hospitalmanage.controller;



import com.woniuxy.micromedicalserver.bean.HospitalLevelBean;
import com.woniuxy.micromedicalserver.bean.ResultMsg;
import com.woniuxy.micromedicalserver.hospitalmanage.service.IHospitalLevelService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/hospital")
@RestController
public class HospitalLevelController {

    @Resource
    private IHospitalLevelService hospitalLevelServiceImpl;

    @GetMapping(value = "/level/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultMsg getHospitalLevelByID(@PathVariable("id") Integer ID){
        HospitalLevelBean hospitalLevelBean = hospitalLevelServiceImpl.selectByID(ID);
        return new ResultMsg(true,hospitalLevelBean);

    }


    @GetMapping(value = "/level", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultMsg getAllHospitalLevel(){

        List<HospitalLevelBean> list = hospitalLevelServiceImpl.selectAll();
        return new ResultMsg(true,list);
    }

}
